package com.method;

import com.sun.jdi.connect.Connector;

/**
 * @Author WaveHi
 * @Date 28/7/2021 下午 4:15
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 方法的定义和调用
 */
public class MethodDemo1 {

    public static void main(String[] args) {

        MethodDemo1 methodDemo1 = new MethodDemo1();
        methodDemo1.func1(1,2,2,4,5,2);
    }

    
    private void func1(int... a){

        int i1 = 0;
         //for循环结构求和
        for(int i = 0;i < a.length;i++){
            i1 += a[i];
        }
        System.out.println("所传参数和为：" + i1);
    }

}
